#include "bo3d.h"

class CIListener : public Ogre::CompositorInstance::Listener
{
public:
	void (*__materialSetup)(Ogre::uint32 passId, Ogre::MaterialPtr &mat);
	void (*__materialRender)(Ogre::uint32 passId, Ogre::MaterialPtr &mat);

	virtual void notifyMaterialSetup( Ogre::uint32 passId, Ogre::MaterialPtr &mat );
	virtual void notifyMaterialRender( Ogre::uint32 passId, Ogre::MaterialPtr &mat );
	void setMaterialSetupPtr(void (*__ptr)(Ogre::uint32 passId, Ogre::MaterialPtr &mat));
	void setMaterialRenderPtr(void (*__ptr)(Ogre::uint32 passId, Ogre::MaterialPtr &mat));
};


void CIListener::notifyMaterialSetup( Ogre::uint32 passId, Ogre::MaterialPtr &mat )
{
	if(this->__materialSetup != NULL) __materialSetup(passId, mat);
}

void CIListener::notifyMaterialRender( Ogre::uint32 passId, Ogre::MaterialPtr &mat )
{
	std::cout << "Test" << std::endl;
	if(this->__materialRender != NULL) __materialRender(passId, mat);
}

void CIListener::setMaterialSetupPtr(void (*__ptr)(Ogre::uint32 passId, Ogre::MaterialPtr &mat))
{
	this->__materialSetup = __ptr;
}

void CIListener::setMaterialRenderPtr(void (*__ptr)(Ogre::uint32 passId, Ogre::MaterialPtr &mat))
{
	this->__materialRender = __ptr;
}


BBDECL CIListener* __stdcall o_createMaterialListener()
{
	return new CIListener();
}


BBDECL void __stdcall o_setMaterialSetupPtr(CIListener* matListener, void (*__ptr)(Ogre::uint32 passId, Ogre::MaterialPtr &mat))
{
	matListener->setMaterialSetupPtr(__ptr);
}


BBDECL void __stdcall o_setMaterialRenderPtr(CIListener* matListener, void (*__ptr)(Ogre::uint32 passId, Ogre::MaterialPtr &mat))
{
	matListener->setMaterialRenderPtr(__ptr);
}
